<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    	               "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
		<link href="Standard.css" rel="stylesheet" type="text/css">
	  	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	  	<title>Home</title>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script type="text/javascript">
      var map;
      function initialize() {
        var mapOptions = {
          zoom: 1,
          draggable: false,
          panControl: true,
          center: new google.maps.LatLng(39.504041,-96.956542),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('googleMapDiv'),
            mapOptions);
        google.maps.event.addListener(map, 'click', function(event) {
            updateLatLng(event.latLng.lat(), event.latLng.lng());
          });
      }
      
      function updateLatLng(lat, lng) {
    	  document.getElementById('latitudeTextBox').value = lat;
    	  document.getElementById('longitudeTextBox').value = lng;
      }

      google.maps.event.addDomListener(window, 'load', initialize);
      </script>
	</head>
	<body>
	<%@ page import="java.util.*" %>
	<%@ page import="jpa.*" %>
	<%@ page import="javax.naming.*" %>
	<%@include file="header.jsp" %>
		<% 
		List<Member> m = stateless.getAllMembers();
		List<Cache> c = stateless.getAllCaches();
		
		%>
		
		<div id = "container">
			<div id="admin">				
			 	<div id = "userPane">
			 		<h2>Users</h2>
			 		<label>Filter</label><input type="text"/>
			 		<div id ="userScroll">
			 			<table>
			 				<%
			 					for(Member mem : m)
			 					{
			 						if(mem.getMemAdmin() != 2)
			 						{
			 				%>
			 				<tr><td><%=mem.getMemName()%></td><td><a href="Controller?do=deleteMember&id=<%=mem.getMemId()%>" class ="standardButton">Delete</a></td></tr>
			 				<%
			 						}
			 					}
			 				%>
			 			</table>
			 		</div>
			 	</div>
			 	<div id= "cachePane">
			 		<h2>Caches</h2>
			 		<label>Filter</label><input type="text"/>
			 		<div id ="cacheScroll">
			 			<table>
			 				<!-- NEED TO CHANGE CSS TO MAKE GREEN IF APPROVED, AND NAME -->
			 				<%
			 					for(Cache cac : c)
			 					{
			 						if(cac.getCacheApproved() != 2)
			 						{
			 				%>
			 							<tr>
			 							<td><%=cac.getCacheName()%></td>
			 							<%
			 							if(cac.getCacheApproved() == 0) //Cache is not approved
			 							{
			 							%>
			 								<td><a href="Controller?do=approveCache&id=<%=cac.getCacheId()%>" class="standardButtonRed">Approve</a></td>
			 							<%
			 							}
			 							else if(cac.getCacheApproved() == 1)
			 							{
			 							%>
			 								<td><a href="Controller?do=approveCache&id=<%=cac.getCacheId()%>" class="standardButtonGreen">Approved</a></td>
			 							<%
			 							}
			 							%>
			 							
			 							<td><a href="Controller?do=deletecache&id=<%=cac.getCacheId()%>" class = "standardButton">Delete</a></td></tr>	  
			 								
			 							
			 				<%
			 						}
			 					}
			 				%>
			 			</table>
			 		</div>
			 	</div>
			 	<br class="clearBoth"/>
			 </div>
		</div>
		<div id="footer"></div>
	</body>
</html> 